package com.yizhe.utils;

import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.TbkItemGetRequest;
import com.taobao.api.response.TbkItemGetResponse;

public class TaobaoApiTest {

	public static void main(String[] args) throws ApiException {
		taobaoApi();
	}
	

	public static void taobaoApi() throws ApiException {
		TaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", "23467780", "49568015efce89fdebcaf2dff10aea4c");
		TbkItemGetRequest req = new TbkItemGetRequest();
		req.setFields("num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick");
		req.setQ("女装");
		req.setCat("16,18");
		req.setItemloc("杭州");
		req.setSort("tk_rate_des");
		/*req.setIsTmall(false);
		req.setIsOverseas(false);
		req.setStartPrice(10L);
		req.setEndPrice(1000L);
		req.setStartTkRate(123L);
		req.setEndTkRate(123L);
		req.setPlatform(1L);
		req.setPageNo(123L);
		req.setPageSize(20L);*/
		TbkItemGetResponse rsp = client.execute(req);
		System.out.println(rsp.getBody());
	}
	/*public static void taobaoApi1() throws ApiException {
		TaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", "23467780", "49568015efce89fdebcaf2dff10aea4c");
		ItemcatsGetRequest req = new ItemcatsGetRequest();
		req.setCids("18957,19562");
		req.setDatetime(StringUtils.parseDateTime("2000-01-01 00:00:00"));
		req.setFields("cid,parent_cid,name,is_parent");
		req.setParentCid(50011999L);
		ItemcatsGetResponse rsp = client.execute(req);
		System.out.println(rsp.getBody());
	}*/

}
